home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2003 March / DPPCPRO0303.ISO / Components / Microsoft ASP / _SETUP.1 / ASPWizard.jar / asp / wizard / WizardViewDbQuery.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-11-20  |  4.9 KB  |  135 lines

  1. package asp.wizard;
  2.  
  3. import asp.netobjects.nfx.wizard.WizardPage;
  4. import asp.netobjects.nfx.wizard.WizardPageView;
  5. import asp.util.ResourceUtil;
  6. import com.sun.java.swing.AbstractButton;
  7. import com.sun.java.swing.JButton;
  8. import com.sun.java.swing.JTextField;
  9. import com.sun.java.swing.text.JTextComponent;
  10.  
  11. public class WizardViewDbQuery extends WizardViewAbstract {
  12.    public static final String ERR_EDIT_WARN = "error.edit_warn";
  13.    private static WizardViewAbstract _instance = null;
  14.    private WVPanelDbQuery _mainPanel;
  15.    // $FF: synthetic field
  16.    static Class class$asp$wizard$WVPanelDbQuery;
  17.  
  18.    public static WizardViewAbstract getInstance() {
  19.       if (_instance == null) {
  20.          _instance = new WizardViewDbQuery();
  21.       }
  22.  
  23.       return _instance;
  24.    }
  25.  
  26.    protected void createMainPanel() {
  27.       this._mainPanel = new WVPanelDbQuery();
  28.       JButton btnSql = this._mainPanel._btnBuildSql;
  29.       ((AbstractButton)btnSql).addActionListener(new 1(this));
  30.       JButton btnQuery = this._mainPanel._btnTestQuery;
  31.       ((AbstractButton)btnQuery).addActionListener(new 2(this));
  32.       JButton btnEditSQL = this._mainPanel._btnEditSql;
  33.       ((AbstractButton)btnEditSQL).addActionListener(new 3(this));
  34.    }
  35.  
  36.    public WVPanelBase getMainPanel() {
  37.       return this._mainPanel;
  38.    }
  39.  
  40.    private void showSqlBuilder() {
  41.       ((WizardModelDbQuery)((WizardPageView)this).getModel()).showSqlBuilder();
  42.    }
  43.  
  44.    private void testQuery() {
  45.       ((WizardModelDbQuery)((WizardPageView)this).getModel()).testQuery();
  46.    }
  47.  
  48.    public void updateView(WizardModelAbstract model, Object arg) {
  49.       if (arg == "_subwizfinished_") {
  50.          this._mainPanel.enableStep2Controls(true);
  51.          this._mainPanel.enableStep3Controls(true);
  52.       }
  53.  
  54.    }
  55.  
  56.    public void updateControls(boolean firstTime) {
  57.       if (firstTime) {
  58.          this._mainPanel.enableStep2ControlsTextboxes(false);
  59.          this._mainPanel.enableStep2Controls(false);
  60.          this._mainPanel.enableStep3Controls(false);
  61.       } else {
  62.          this._mainPanel.enableStep2Controls(true);
  63.          this._mainPanel.enableStep3Controls(true);
  64.          this._mainPanel.enableStep2ControlsTextboxes(false);
  65.       }
  66.  
  67.    }
  68.  
  69.    public void setModel(WizardPage model) {
  70.       super.setModel(model);
  71.    }
  72.  
  73.    public void editSQL() {
  74.       String err = ResourceUtil.getResourceString("asp.wizard.res", class$asp$wizard$WVPanelDbQuery != null ? class$asp$wizard$WVPanelDbQuery : (class$asp$wizard$WVPanelDbQuery = class$("asp.wizard.WVPanelDbQuery")), "error.edit_warn");
  75.       AspWizardExceptionHandler.showMessage(0, err);
  76.       this._mainPanel.enableStep2ControlsTextboxes(true);
  77.    }
  78.  
  79.    private void setTextFieldText(JTextField textField, String text) {
  80.       ((JTextComponent)textField).setText(text);
  81.       textField.setScrollOffset(0);
  82.    }
  83.  
  84.    public void setSelect(String select) {
  85.       this.setTextFieldText(this._mainPanel._txfSelect, select);
  86.    }
  87.  
  88.    public void setFrom(String from) {
  89.       this.setTextFieldText(this._mainPanel._txfFrom, from);
  90.    }
  91.  
  92.    public void setWhere(String where) {
  93.       this.setTextFieldText(this._mainPanel._txfWhere, where);
  94.    }
  95.  
  96.    public void setOrderBy(String orderBy) {
  97.       this.setTextFieldText(this._mainPanel._txfOrderBy, orderBy);
  98.    }
  99.  
  100.    public String getSelect() {
  101.       return this._mainPanel._txfSelect.getText();
  102.    }
  103.  
  104.    public String getFrom() {
  105.       return this._mainPanel._txfFrom.getText();
  106.    }
  107.  
  108.    public String getWhere() {
  109.       return this._mainPanel._txfWhere.getText();
  110.    }
  111.  
  112.    public String getOrderBy() {
  113.       return this._mainPanel._txfOrderBy.getText();
  114.    }
  115.  
  116.    // $FF: synthetic method
  117.    static void access$0(WizardViewDbQuery $0) {
  118.       $0.showSqlBuilder();
  119.    }
  120.  
  121.    // $FF: synthetic method
  122.    static void access$1(WizardViewDbQuery $0) {
  123.       $0.testQuery();
  124.    }
  125.  
  126.    // $FF: synthetic method
  127.    static Class class$(String class$) {
  128.       try {
  129.          return Class.forName(class$);
  130.       } catch (ClassNotFoundException forName) {
  131.          throw new NoClassDefFoundError(((Throwable)forName).getMessage());
  132.       }
  133.    }
  134. }
  135.